<!--
  @author duanzuocai
  @since 2018/10/23 15:12
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

<head th:include="common/common :: jscss">
    <title>新增或编辑部门</title>
</head>
<body>

<div class="layui-fluid">
    <blockquote class="layui-crumb">
        组织关系><a lay-href="/system/organ/list.action">组织架构</a>>
        <zmn th:text="${(organ.orgId == null||organ.orgId == 0) ? '新增组织':organ.orgName}"></zmn>
        >部门列表> <zmn th:text="${(dept.deptId == null||dept.deptId == 0) ? '新增部门':dept.deptName}"></zmn>
    </blockquote>
    <div class="layui-card">
        <form method="post" action="" class="layui-form" lay-filter="zmn-form">

            <input type="hidden" name="deptId" th:value="${dept.deptId}"/>
            <input type="hidden" name="parentId" th:value="${parent.deptId}"/>
            <input type="hidden" name="orgId" th:value="${orgId}"/>

            <div class="layui-card-header" style="margin-top:10px;"><b>基本信息</b></div>
            <div class="layui-split">&nbsp;</div>
            <div class="layui-form-item">
                <label class="layui-form-label">上级部门</label>
                <div class="layui-form-mid layui-word-aux">
                    <span th:text="${parent.deptName}"></span> <span th:text="${'<'+parent.deptId+'>'}"></span>
                </div>
            </div>

            <div class="layui-form-item layui-form-item-sm" th:if="${dept.deptId>0}">
                <label class="layui-form-label">部门ID：</label>
                <div class="layui-input-block">
                    <div class="layui-form-mid layui-word-aux">
                        <span th:text="${dept.deptId}"></span>&nbsp;&nbsp;
                        <th:block th:switch="${dept.status}">
                            <span th:case="2" class="layui-badge layui-bg-green">正常</span>
                            <span th:case="1" class="layui-badge layui-btn-danger">停用</span>
                        </th:block>
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">部门名称</label>
                <div class="layui-input-inline" style="width:400px;">
                    <input type="text" name="deptName" lay-verify="required" th:value="${dept.deptName}"
                           class="layui-input" maxlength="32"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">部门负责人</label>
                <div class="layui-input-inline"  style="width:400px;">
                        <select name="keyStaffId" lay-search="" th:value="${dept.keyStaffId}">
                            <option value="">请选择</option>
                            <zmn th:each="staff:${staffs}">
                                <option th:value="${staff.staffId}" th:selected="${staff.staffId == dept.keyStaffId}"
                                        th:text="${staff.realName}">
                                </option>
                            </zmn>
                        </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">排序</label>
                <div class="layui-input-inline" style="width:400px;">
                    <input type="text" name="sort" th:value="${dept.sort}" lay-verify="sort" class="layui-input" maxlength="6" minlength="1"/>
                </div>
                <div class="layui-form-mid layui-word-aux">越小越靠前</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">状态</label>
                <div class="layui-input-inline"  style="width:400px;">
                    <select name="status">
                        <option th:each="status:${statuses}" th:value="${status.key}" th:text="${status.value}" th:selected="${status.key == dept.status}">
                    </select>
                </div>
            </div>
            <zmn th:if="${dept.deptId > 0}">
                <div class="layui-card-header"><b>其他信息</b></div>
                <div class="layui-split">&nbsp;</div>
                <div class="layui-form-item layui-form-item-xs">
                    <label class="layui-form-label">修改人/时间</label>
                    <div class="layui-input-block">
                        <div class="layui-form-mid layui-word-aux" th:text="${dept.updater} + '&nbsp;/&nbsp;' + ${#dates.format(dept.updateTime, 'yyyy-MM-dd HH:mm:ss')}">修改人/时间</div>
                    </div>
                </div>
                <div class="layui-form-item layui-form-item-xs">
                    <label class="layui-form-label">创建人/时间</label>
                    <div class="layui-input-block">
                        <div class="layui-form-mid layui-word-aux" th:text="${dept.creater} + '&nbsp;/&nbsp;' + ${#dates.format(dept.createTime, 'yyyy-MM-dd HH:mm:ss')}">创建人/时间</div>
                    </div>
                </div>
            </zmn>

            <div class="layui-split">&nbsp;</div>
            <div class="layui-form-item layui-layout-admin">
                <div class="layui-input-block">
                    <div class="layui-footer" style="left: 0;">
                        <button class="layui-btn" lay-submit="" lay-filter="zmn-form-submit" th:if="${#authPermit.checkPermit('/mc/dept/addEdit.action')}">保存</button>
                        <button class="layui-btn layui-btn-primary" onclick="layui.admin.events.closeThisTabs();">取消</button>
                    </div>
                </div>
            </div>

        </form>

    </div>

</div>

<script type="text/javascript" th:inline="javascript">

    layui.config({
        base: "/static/lay/"
    }).extend({
        index: "lib/index",
        art_organ_dept_detail: "mc/organ/zmn.art.mc.organ.dept.edit",
    }).use(['index', 'art_organ_dept_detail']);

</script>
<script>


</script>
</body>
</html>